package com.usian.admin.controller;

import com.usian.admin.service.impl.AutoAuditServiceImpl;
import com.usian.apis.article.AutoAuditControllerApi;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.media.pojos.WmNews;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/autoaudit")
public class AutoAuditController implements AutoAuditControllerApi {
    @Autowired
    AutoAuditServiceImpl autoAuditService;
    @Override
    @GetMapping("/audit/{id}")
    public ResponseResult autoExamine(@PathVariable Integer id) {
        return autoAuditService.autoExamine(id);
    }
    @Override
    @GetMapping("/pass/{id}")
    public ResponseResult pass(@PathVariable Integer id) {
        return autoAuditService.updateStatus(id, WmNews.Status.SUCCESS.getCode());
    }

    @Override
    @GetMapping("/fail/{id}")
    public ResponseResult fail(@PathVariable Integer id) {
        return autoAuditService.updateStatus(id,WmNews.Status.FAIL.getCode());
    }
}
